package com.example.chat.client;

import com.example.chat.entity.ChatRequestBody;
import com.example.chat.entity.ChatResponse;
import com.example.chat.entity.ChatTokenResponse;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;
import reactor.core.publisher.Flux;


import java.util.Map;

@HttpExchange
public interface ChatWebClient {

    @PostExchange("/oauth/2.0/token")
    ChatTokenResponse getToken(@RequestHeader Map<String,String> header, @RequestParam Map<String, String> paramMap);

    @PostExchange("/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions")
    Flux<ChatResponse> getChatMessage(@RequestHeader Map<String,String> header,
                                      @RequestParam Map<String,String> param,
                                      @RequestBody ChatRequestBody chatRequestBody);
}
